package com.zwj.task;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.time.LocalDateTime;

/**
 * @author zwj
 * @Description: 定时任务
 * @date 2022/7/12 11:39 上午
 */
@Configuration     //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling  //开启定时任务
public class MyTask {

//    @Scheduled(cron = "0/5 * * * * ?")
    private void myTask1() {
        System.out.println("执行定时任务的时间：" + LocalDateTime.now());
    }
}
